package cn.xinfei.xdecision.engine.api;

import cn.xinfei.xdecision.engine.runner.context.PipelineContext;
import cn.xinfei.xdecision.engine.runner.service.DecisionResultDetailService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("engine/mongo")
public class XDecisionMongoApi {

    @Autowired
    private DecisionResultDetailService decisionResultDetailService;


    @ApiOperation(value = "upsertMongo")
    @RequestMapping(value = "/upsert", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public boolean upsertTest(@RequestBody PipelineContext pipelineContext, @RequestParam String executorDecisionId, @RequestParam String updateDecisionId){
        boolean b = decisionResultDetailService.upsertDecisionResultDetailLog(pipelineContext,executorDecisionId, updateDecisionId);
        return b;
    }

}
